﻿using AppService.IService.Financial_Management;
using AppService.Service.Financial_Management;
using Domain.Entity.Basic_information;
using Domain.Entity.Financial_Management;
using Domain.Entity.System_operation;
using Domain.Entity.System_Ordermanagement;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.Financial_Management
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Payable_meterController : ControllerBase
    {
        private readonly IPayable_meterService Ipayable_meterService;

        public Payable_meterController(IPayable_meterService ipayable_meterService)
        {
            Ipayable_meterService = ipayable_meterService;
        }
        [HttpGet]
        public int Count(string? Billing_status, string? Origin_place, string? Det_place, string? Sign_time)
        {
            return Ipayable_meterService.Count(Billing_status, Origin_place, Det_place, Sign_time);
        }

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Payable_meter> GetPayable_meter(int currentPage, int PageSize)
        {
            List<Payable_meter> zhi = Ipayable_meterService.GetPayable_meter(currentPage, PageSize);
            return zhi;
        }

        [HttpGet("{id}")]
        public Wb_meter GetWb_id(int id)
        {
            return Ipayable_meterService.GetWb_id(id);
        }

        [HttpGet("{id}")]
        public Signature_receipt GetSign_id(int id)
        {
            return Ipayable_meterService.GetSign_id(id);
        }

        [HttpGet("{id}")]
        public Carrier_ment GetCarrier_id(int id)
        {
            return Ipayable_meterService.GetCarrier_id(id);
        }
        [HttpGet("{id}")]
        public Drivers_ment GetDrivers_id(int id)
        {
            return Ipayable_meterService.GetDrivers_id(id);
        }
        /// <summary>
        /// 根据id查询
        /// </summary>
        /// <param name="Receivable_Id"></param>
        /// <returns></returns>
        [HttpGet("{Payable_id}")]
        public List<Payable_meter> GetPayable_meter_Update(int Payable_id)
        {
            return Ipayable_meterService.GetPayable_meter_Update(Payable_id);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="receivable_meter"></param>
        /// <returns></returns>
        [HttpPut]
        public bool Update([FromBody] Payable_meter payable_meter)
        {
            return Ipayable_meterService.Update(payable_meter);
        }
    }
}
